package com.ys.controller.web.purchase;

import com.bo.vo.W;
import com.ys.config.MenuId;
import com.ys.entity.purchase.TcgDistribution;
import com.ys.entity.purchase.TsApi1688ToKen;
import com.ys.service.sys.CommonApiService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.Map;


/**
 * 1688铺货web
 */
@Controller
@RequestMapping("/web/purchase/tcgDistribution")
public class WebTcgDistributionController {
	private static final Logger logger = LoggerFactory.getLogger(WebTcgDistributionController.class);
	private final Long MENU_ID = MenuId.TCG_Distribution;

	@Autowired
	private CommonApiService<TcgDistribution> commonApiService;


	//修改1688信息
	@GetMapping("/toEdit")
	public String edit(Model model,Long id){
		try {
			TcgDistribution tcgDistribution = new TcgDistribution().setId(id).queryFirst();
			if (tcgDistribution == null){
				return com.ys.vo.W.error(model, "1688铺货数据为空!");
			}
			return commonApiService.toEdit(model, id, new TcgDistribution(), MENU_ID, null, null);
		}catch (Exception e) {
			logger.error("修改1688信息页面出错：",e.getMessage(),e);
			return W.error(model, e.getMessage());
		}
	}


}
